﻿<local:SectionWidget x:Class="WpfApp1.Views.ProductsReviewsSectionWidget"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:WpfApp1.Views"
             mc:Ignorable="d" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <Grid Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="88*"></RowDefinition>
            <RowDefinition Height="auto"></RowDefinition>
        </Grid.RowDefinitions>
        <DataGrid x:Name="dataGrid" Grid.Row="0" AutoGenerateColumns="False" IsReadOnly="True">
            <DataGrid.Resources>
                <Style TargetType="DataGridColumnHeader">
                    <EventSetter Event="MouseDoubleClick" Handler="DataGridColumnHeader_DoubleClick" />
                </Style>
            </DataGrid.Resources>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Id" Binding="{Binding Path=OrderId}" Width="40" />
                <DataGridTextColumn Header="Id товара" Binding="{Binding Path=Order.Product.Id}" Width="80" />
                <DataGridTextColumn Header="Товар" Binding="{Binding Path=Order.Product.Title}" Width="200" />
                <DataGridTextColumn Header="Id пользователя" Binding="{Binding Path=Order.User.Id}" Width="120" />
                <DataGridTextColumn Header="Фамилия" Binding="{Binding Path=Order.User.Lastname}" Width="90" />
                <DataGridTextColumn Header="Имя" Binding="{Binding Path=Order.User.Firstname}" Width="90" />
                <DataGridTextColumn Header="Отчество" Binding="{Binding Path=Order.User.Patronymic}" Width="90" />
                <DataGridTextColumn Header="Отзыв" Binding="{Binding Path=ReviewText}" Width="240" />
                <DataGridTextColumn Header="Оценка" Binding="{Binding Path=Stars}" Width="110" />
            </DataGrid.Columns>
        </DataGrid>
        <DockPanel Grid.Row="1" Margin="10" Height="32">
            <Button x:Name="btnPDF" Width="90" Template="{StaticResource commonButton}" Command="{Binding PDFCommand}">В PDF</Button>
            <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" FlowDirection="RightToLeft">
                <Button x:Name="btnClose" Width="90" Margin="10 0" Template="{StaticResource commonButton}" Command="{Binding CloseCommand}">Закрыть</Button>
                <Button x:Name="btnRead"  Width="90" Margin="10 0" Template="{StaticResource commonButton}" Command="{Binding ReadCommand}">Просмотр</Button>
                <Button x:Name="btnDelete" Width="90" Margin="10 0" Template="{StaticResource commonButton}" Command="{Binding DeleteCommand}">Удалить</Button>
                <Button x:Name="btnUpdate" Width="90" Margin="10 0" Template="{StaticResource commonButton}" Command="{Binding UpdateCommand}">Изменить</Button>
                <Button x:Name="btnInsert" Width="90" Margin="10 0" Template="{StaticResource commonButton}" Command="{Binding InsertCommand}">Вставить</Button>
            </StackPanel>
        </DockPanel>

    </Grid>
</local:SectionWidget >
